package cn.tedu.mapper;

import cn.tedu.entity.Account;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.math.BigDecimal;

/**
 * @author Administrator
 */
public interface AccountMapper extends BaseMapper<Account> {
    /**
     * 扣减账户金额
     * @param userId
     * @param money
     */
    void decrease(Long userId, BigDecimal money);

    //查询账户
    Account findByUserId(Long userId);
    //可用->冻结
    void updateResidueToFrozen(Long userId,BigDecimal money);
    //冻结 -> 已消费
    void updateFrozenToUsed(Long userId,BigDecimal money);
    //冻结 -> 可用
    void updateFrozenToResidue(Long userId,BigDecimal money);
}
